using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Proje2Dto3D
{
    class HUD
    {
        SpriteBatch spriteBatch;
        SpriteFont textFont;

        Timer timer;
        int fpsCount = 0;
        int fps = 0;

        public HUD()
        {
            textFont = Editor.content.Load<SpriteFont>(@"content\\fonts\\tahoma");
            spriteBatch = new SpriteBatch(Editor.graphics.GraphicsDevice);

            timer = new Timer(1000);
            timer.Elapsed += new ElapsedEventHandler(timer_tick);
            timer.Enabled = true;
        }

        private void timer_tick(Object obj, ElapsedEventArgs v_args)
        {
            fps = fpsCount;
            fpsCount = 0;
        }

        public void Update()
        {
        }

        public void Draw()
        {
            fpsCount++;

            spriteBatch.Begin(SpriteBlendMode.AlphaBlend);

            if (Editor.console != null && Editor.console.state == ConsoleHUD.State.Closed)
            {
                spriteBatch.DrawString(textFont, "CTRL-S: Ayarlar", new Vector2(5f, 0f), Color.White);
            }

            //Kamera Bilgisi
            if (Editor.camera != null)
            {
                spriteBatch.DrawString(textFont, "Kamera X: " + Math.Round(Editor.camera.position.X, 5), new Vector2(5f, 540f), Color.White);
                spriteBatch.DrawString(textFont, "Kamera Y: " + Math.Round(Editor.camera.position.Y, 5), new Vector2(5f, 555f), Color.White);
                spriteBatch.DrawString(textFont, "Kamera Z: " + Math.Round(Editor.camera.position.Z, 5), new Vector2(5f, 570f), Color.White);
            }

            if (Editor.heightmap != null)
            {
            }

            spriteBatch.End();
        }
    }
}
